package test.domain;

import java.util.HashMap;
import java.util.Map;

public class Month2 {
	private String name;

	public Month2(String name) {
		this.name = name;
	}

	public String toString() {
		return name;
	}

	public int hashCode() {
		char[] chars = name.toCharArray();
		String charString = null;
		for (char char0 : chars) {
			charString += String.valueOf((int) char0);

		}
		return charString.hashCode();
	}

	public boolean equals(Object o) {
		if (this.getClass() != o.getClass()) {
			return false;
		}
		if (this.hashCode() == o.hashCode()) {
			return true;
		}
		return false;
	}

	public Month2 getMonth2(String name) {
		return new Month2(name);
	}

	public static Month2 JAN = new Month2("January");
	public static Month2 FEB = new Month2("Febuary");
	public static Month2[] months = { JAN, FEB };

	public static void main(String[] args) {
		Month2 january = Month2.JAN;
		Month2 jan = january.getMonth2("January");
		Map<Month2, String> map = new HashMap<>();
		map.put(january, "1");
		map.put(jan, "2");
		System.out.println(map.get(january));
		// System.out.println(january == Month2.months[0]);
		// System.out.println(january.equals(Month2.months[0]));
		System.out.println(january.equals(jan));
		System.out.println(jan.hashCode());
		// Test1 test1 = new Test1();
		// System.out.println(test1);
		// System.out.println(test1.hashCode());
		// System.out.println(test1.toString());
	}
}
